package com.polaris.live.ui.party.widget.seat

import com.polaris.live.im.sfs.bean.live.LiveRoomInfo

/**
 * 座位控制
 * @author Created by 天晴 on 2024/2/26 9:35
 * @since 1.0.0
 **/
object SeatBeanUtil {

    /**
     * 座位表
     */
    private val seatExpress: Map<String, Int> = (0..20).flatMap { index ->
        listOf(
            "siteUser$index" to index,
            "siteLock$index" to index,
            "siteMicStatus$index" to index,
            "siteGainCoin$index" to index,
            "siteStreamId$index" to index
        )
    }.toMap()

    /**
     * 游戏座位表
     */
    private val gameSeatExpress: Map<String, Int> = (0..8).flatMap { index ->
        listOf(
            "gameSite$index" to index,
            "gameLoad$index" to index,
        )
    }.toMap()

    /**
     * 获取游戏座位id 不存在返回null
     */
    fun getGameSeatId(name: String): Int? {
        return gameSeatExpress[name]
    }

    /**
     * 获取座位id 不存在返回null
     */
    fun getSeatId(name: String): Int? {
        return seatExpress[name]
    }

    fun getGameSite(mLiveInfo: LiveRoomInfo, index: Int): String? {
        return when (index) {
            0 -> mLiveInfo.gameSite0
            1 -> mLiveInfo.gameSite1
            2 -> mLiveInfo.gameSite2
            3 -> mLiveInfo.gameSite3
            4 -> mLiveInfo.gameSite4
            5 -> mLiveInfo.gameSite5
            6 -> mLiveInfo.gameSite6
            7 -> mLiveInfo.gameSite7
            8 -> mLiveInfo.gameSite8
            else -> null
        }
    }

    fun getGameLoad(mLiveInfo: LiveRoomInfo, index: Int): Boolean? {
        return when (index) {
            0 -> mLiveInfo.gameLoad0
            1 -> mLiveInfo.gameLoad1
            2 -> mLiveInfo.gameLoad2
            3 -> mLiveInfo.gameLoad3
            4 -> mLiveInfo.gameLoad4
            5 -> mLiveInfo.gameLoad5
            6 -> mLiveInfo.gameLoad6
            7 -> mLiveInfo.gameLoad7
            8 -> mLiveInfo.gameLoad8
            else -> null
        }
    }

    fun getUserJson(mLiveInfo: LiveRoomInfo, index: Int): String? {
        return when (index) {
            0 -> mLiveInfo.siteUser0
            1 -> mLiveInfo.siteUser1
            2 -> mLiveInfo.siteUser2
            3 -> mLiveInfo.siteUser3
            4 -> mLiveInfo.siteUser4
            5 -> mLiveInfo.siteUser5
            6 -> mLiveInfo.siteUser6
            7 -> mLiveInfo.siteUser7
            8 -> mLiveInfo.siteUser8
            9 -> mLiveInfo.siteUser9
            10 -> mLiveInfo.siteUser10
            11 -> mLiveInfo.siteUser11
            12 -> mLiveInfo.siteUser12
            13 -> mLiveInfo.siteUser13
            14 -> mLiveInfo.siteUser14
            15 -> mLiveInfo.siteUser15
            16 -> mLiveInfo.siteUser16
            17 -> mLiveInfo.siteUser17
            18 -> mLiveInfo.siteUser18
            19 -> mLiveInfo.siteUser19
            20 -> mLiveInfo.siteUser20
            else -> null
        }
    }

    fun getLock(mLiveInfo: LiveRoomInfo, index: Int): Boolean? {
        return when (index) {
            0 -> mLiveInfo.siteLock0
            1 -> mLiveInfo.siteLock1
            2 -> mLiveInfo.siteLock2
            3 -> mLiveInfo.siteLock3
            4 -> mLiveInfo.siteLock4
            5 -> mLiveInfo.siteLock5
            6 -> mLiveInfo.siteLock6
            7 -> mLiveInfo.siteLock7
            8 -> mLiveInfo.siteLock8
            9 -> mLiveInfo.siteLock9
            10 -> mLiveInfo.siteLock10
            11 -> mLiveInfo.siteLock11
            12 -> mLiveInfo.siteLock12
            13 -> mLiveInfo.siteLock13
            14 -> mLiveInfo.siteLock14
            15 -> mLiveInfo.siteLock15
            16 -> mLiveInfo.siteLock16
            17 -> mLiveInfo.siteLock17
            18 -> mLiveInfo.siteLock18
            19 -> mLiveInfo.siteLock19
            20 -> mLiveInfo.siteLock20
            else -> null
        }
    }

    fun getMicStatus(mLiveInfo: LiveRoomInfo, index: Int): Int? {
        return when (index) {
            0 -> mLiveInfo.siteMicStatus0
            1 -> mLiveInfo.siteMicStatus1
            2 -> mLiveInfo.siteMicStatus2
            3 -> mLiveInfo.siteMicStatus3
            4 -> mLiveInfo.siteMicStatus4
            5 -> mLiveInfo.siteMicStatus5
            6 -> mLiveInfo.siteMicStatus6
            7 -> mLiveInfo.siteMicStatus7
            8 -> mLiveInfo.siteMicStatus8
            9 -> mLiveInfo.siteMicStatus9
            10 -> mLiveInfo.siteMicStatus10
            11 -> mLiveInfo.siteMicStatus11
            12 -> mLiveInfo.siteMicStatus12
            13 -> mLiveInfo.siteMicStatus13
            14 -> mLiveInfo.siteMicStatus14
            15 -> mLiveInfo.siteMicStatus15
            16 -> mLiveInfo.siteMicStatus16
            17 -> mLiveInfo.siteMicStatus17
            18 -> mLiveInfo.siteMicStatus18
            19 -> mLiveInfo.siteMicStatus19
            20 -> mLiveInfo.siteMicStatus20
            else -> null
        }
    }

    fun getSiteVideoStatus(mLiveInfo: LiveRoomInfo, index: Int): Int? {
        return when (index) {
            0 -> mLiveInfo.siteVideoStatus0
            1 -> mLiveInfo.siteVideoStatus1
            2 -> mLiveInfo.siteVideoStatus2
            3 -> mLiveInfo.siteVideoStatus3
            4 -> mLiveInfo.siteVideoStatus4
            5 -> mLiveInfo.siteVideoStatus5
            6 -> mLiveInfo.siteVideoStatus6
            7 -> mLiveInfo.siteVideoStatus7
            8 -> mLiveInfo.siteVideoStatus8
            9 -> mLiveInfo.siteVideoStatus9
            10 -> mLiveInfo.siteVideoStatus10
            11 -> mLiveInfo.siteVideoStatus11
            12 -> mLiveInfo.siteVideoStatus12
            13 -> mLiveInfo.siteVideoStatus13
            14 -> mLiveInfo.siteVideoStatus14
            15 -> mLiveInfo.siteVideoStatus15
            16 -> mLiveInfo.siteVideoStatus16
            17 -> mLiveInfo.siteVideoStatus17
            18 -> mLiveInfo.siteVideoStatus18
            19 -> mLiveInfo.siteVideoStatus19
            20 -> mLiveInfo.siteVideoStatus20
            else -> null
        }
    }

    fun getGainCoin(mLiveInfo: LiveRoomInfo, index: Int): Long? {
        return when (index) {
            0 -> mLiveInfo.siteGainCoin0
            1 -> mLiveInfo.siteGainCoin1
            2 -> mLiveInfo.siteGainCoin2
            3 -> mLiveInfo.siteGainCoin3
            4 -> mLiveInfo.siteGainCoin4
            5 -> mLiveInfo.siteGainCoin5
            6 -> mLiveInfo.siteGainCoin6
            7 -> mLiveInfo.siteGainCoin7
            8 -> mLiveInfo.siteGainCoin8
            9 -> mLiveInfo.siteGainCoin9
            10 -> mLiveInfo.siteGainCoin10
            11 -> mLiveInfo.siteGainCoin11
            12 -> mLiveInfo.siteGainCoin12
            13 -> mLiveInfo.siteGainCoin13
            14 -> mLiveInfo.siteGainCoin14
            15 -> mLiveInfo.siteGainCoin15
            16 -> mLiveInfo.siteGainCoin16
            17 -> mLiveInfo.siteGainCoin17
            18 -> mLiveInfo.siteGainCoin18
            19 -> mLiveInfo.siteGainCoin19
            20 -> mLiveInfo.siteGainCoin20
            else -> null
        }
    }

    fun getSpendCoin(mLiveInfo: LiveRoomInfo, index: Int): Long? {
        return when (index) {
            0 -> mLiveInfo.siteSpendCoin0
            1 -> mLiveInfo.siteSpendCoin1
            2 -> mLiveInfo.siteSpendCoin2
            3 -> mLiveInfo.siteSpendCoin3
            4 -> mLiveInfo.siteSpendCoin4
            5 -> mLiveInfo.siteSpendCoin5
            6 -> mLiveInfo.siteSpendCoin6
            7 -> mLiveInfo.siteSpendCoin7
            8 -> mLiveInfo.siteSpendCoin8
            9 -> mLiveInfo.siteSpendCoin9
            10 -> mLiveInfo.siteSpendCoin10
            11 -> mLiveInfo.siteSpendCoin11
            12 -> mLiveInfo.siteSpendCoin12
            13 -> mLiveInfo.siteSpendCoin13
            14 -> mLiveInfo.siteSpendCoin14
            15 -> mLiveInfo.siteSpendCoin15
            16 -> mLiveInfo.siteSpendCoin16
            17 -> mLiveInfo.siteSpendCoin17
            18 -> mLiveInfo.siteSpendCoin18
            19 -> mLiveInfo.siteSpendCoin19
            20 -> mLiveInfo.siteSpendCoin20
            else -> null
        }
    }

    fun getStreamId(mLiveInfo: LiveRoomInfo, index: Int): String? {
        return when (index) {
            0 -> mLiveInfo.siteStreamId0
            1 -> mLiveInfo.siteStreamId1
            2 -> mLiveInfo.siteStreamId2
            3 -> mLiveInfo.siteStreamId3
            4 -> mLiveInfo.siteStreamId4
            5 -> mLiveInfo.siteStreamId5
            6 -> mLiveInfo.siteStreamId6
            7 -> mLiveInfo.siteStreamId7
            8 -> mLiveInfo.siteStreamId8
            9 -> mLiveInfo.siteStreamId9
            10 -> mLiveInfo.siteStreamId10
            11 -> mLiveInfo.siteStreamId11
            12 -> mLiveInfo.siteStreamId12
            13 -> mLiveInfo.siteStreamId13
            14 -> mLiveInfo.siteStreamId14
            15 -> mLiveInfo.siteStreamId15
            16 -> mLiveInfo.siteStreamId16
            17 -> mLiveInfo.siteStreamId17
            18 -> mLiveInfo.siteStreamId18
            19 -> mLiveInfo.siteStreamId19
            20 -> mLiveInfo.siteStreamId20
            else -> null
        }
    }
}